#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Richard_Kong

"""
此文件封装login接口的API
"""
from config import config
import requests as requests


class LogInAPI(object):

    def __init__(self):
        """
        初始化登陆的一些方法，将公共的配置文件信息放到conf文件夹下
        """
        self.login_url = config.login_url

    def login(self, session, login_data):
        """
        使用session的json数据默认请求头content-type 为application/json
        :type login_data: dict
        :param login_data: 登陆请求体中的数据
        :type session: requests.Session
        :param session:
        :return: requests.Response
        :rtype:requests.Response
        """

        response = session.post(url=self.login_url, json=login_data)

        return response
